#include "intr.h"
    .h8300h
    .section .text

    .global _intr_softerr
    .type   _intr_softerr,@function
_intr_softerr:
    mov.l   er6,@-er7
    mov.w   #SOFTVEC_TYPE_SOFTERR,r6
    jmp     intr_common

    .global _intr_syscall
    .type   _intr_syscall,@function
_intr_syscall:
    mov.l   er6,@-er7
    mov.w   #SOFTVEC_TYPE_SYSCALL,r6
    jmp     intr_common

    .global _intr_serintr
    .type   _intr_serintr,@function
_intr_serintr:
    mov.l   er6,@-er7
    mov.w   #SOFTVEC_TYPE_SERINTR,r6
    jmp     intr_common

    .global _intr_ethintr
    .type   _intr_ethintr,@function
_intr_ethintr:
    mov.l   er6,@-er7
    mov.w   #SOFTVEC_TYPE_ETHINTR,r6
    jmp     intr_common

    .global _intr_t16intr_0
    .type   _intr_t16intr_0,@function
_intr_t16intr_0:
    mov.l   er6,@-er7
    mov.w   #SOFTVEC_TYPE_T16INTR_0,r6
    jmp     intr_common

    .global _intr_t16intr_1
    .type   _intr_t16intr_1,@function
_intr_t16intr_1:
    mov.l   er6,@-er7
    mov.w   #SOFTVEC_TYPE_T16INTR_1,r6
    jmp     intr_common

    .global _intr_t16intr_2
    .type   _intr_t16intr_2,@function
_intr_t16intr_2:
    mov.l   er6,@-er7
    mov.w   #SOFTVEC_TYPE_T16INTR_2,r6
    jmp     intr_common

    .global _intr_t8intr_01
    .type   _intr_t8intr_01,@function
_intr_t8intr_01:
    mov.l   er6,@-er7
    mov.w   #SOFTVEC_TYPE_T8INTR_01,r6
    jmp     intr_common

    .global _intr_t8intr_23
    .type   _intr_t8intr_23,@function
_intr_t8intr_23:
    mov.l   er6,@-er7
    mov.w   #SOFTVEC_TYPE_T8INTR_23,r6
    jmp     intr_common

intr_common:
    mov.l   er5,@-er7
    mov.l   er4,@-er7
    mov.l   er3,@-er7
    mov.l   er2,@-er7
    mov.l   er1,@-er7
    mov.l   er0,@-er7
    mov.l   er7,er1
    mov.l   #_intrstack,sp
    mov.l   er1,@-er7
    mov.w   r6,r0
    jsr     @_interrupt
    mov.l   @er7+,er1
    mov.l   er1,er7
    mov.l   @er7+,er0
    mov.l   @er7+,er1
    mov.l   @er7+,er2
    mov.l   @er7+,er3
    mov.l   @er7+,er4
    mov.l   @er7+,er5
    mov.l   @er7+,er6
    rte
